home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Nave / Cosmic Defender.swf / scripts / frame_11 / DoAction.as
Encoding:
Text File  |  2006-06-13  |  16.8 KB  |  694 lines

  1. function ShowMessage(abduction)
  2. {
  3.    if(abduction)
  4.    {
  5.       _root.message.gotoAndStop(2);
  6.    }
  7.    else
  8.    {
  9.       var remove = true;
  10.       var i = 1;
  11.       while(i < 10)
  12.       {
  13.          if(eval("_root.ship_" + i).action == 2)
  14.          {
  15.             remove = false;
  16.             i = 10;
  17.          }
  18.          i++;
  19.       }
  20.       if(remove)
  21.       {
  22.          _root.message.gotoAndStop(1);
  23.       }
  24.    }
  25. }
  26. function CheckLevelFin()
  27. {
  28.    var _loc1_ = _root;
  29.    _loc1_.enemies_on -= 1;
  30.    _loc1_.enemies_to_kill = _loc1_.enemies_to_kill != 0 ? --_loc1_.enemies_to_kill : 0;
  31.    if(_loc1_.enemies_on <= 0 && _loc1_.enemies_to_kill <= 0)
  32.    {
  33.       _loc1_.ship_0.turbine.stop();
  34.       _loc1_.gotoAndPlay("next_level");
  35.    }
  36. }
  37. function ExtraBomb()
  38. {
  39.    var _loc1_ = _root;
  40.    var _loc2_ = Math.floor(_loc1_.score / _loc1_.extra_bombs);
  41.    if(_loc2_ + 1 >= _loc1_.score / _loc1_.extra_bombs && !_loc1_.ex_bomb_array[_loc2_])
  42.    {
  43.       _loc1_.ex_bomb_array[_loc2_] = true;
  44.       _loc1_.smartbombs += 1;
  45.       if(_loc1_.sound_on)
  46.       {
  47.          _loc1_.extra_life_sfx.start(0,1);
  48.       }
  49.    }
  50. }
  51. function ExtraLife()
  52. {
  53.    var _loc1_ = _root;
  54.    var _loc2_ = Math.floor(_loc1_.score / _loc1_.extra_points);
  55.    if(_loc2_ + 1 >= _loc1_.score / _loc1_.extra_points && !_loc1_.ex_lives_array[_loc2_])
  56.    {
  57.       _loc1_.ex_lives_array[_loc2_] = true;
  58.       _loc1_.lives += 1;
  59.       if(_loc1_.sound_on)
  60.       {
  61.          _loc1_.extra_life_sfx.start(0,1);
  62.       }
  63.    }
  64. }
  65. function RemoveAll()
  66. {
  67.    var s = 0;
  68.    while(s < 21)
  69.    {
  70.       removeMovieClip(eval("_root.comp_" + s));
  71.       removeMovieClip(eval("_root.ship_" + s));
  72.       removeMovieClip(eval("_root.shot_" + s));
  73.       removeMovieClip(eval("_root.ensh_" + s));
  74.       removeMovieClip(eval("_root.man_" + s));
  75.       removeMovieClip(eval("_root.b_" + s));
  76.       removeMovieClip(eval("_root.mine_" + s));
  77.       s++;
  78.    }
  79.    _root.ship_speed = 0;
  80.    _root.colTrans = {ra:100,rb:0,ga:100,gb:0,ba:100,bb:0,aa:100,ab:0};
  81.    _root.bigBangColor.setTransform(_root.colTrans);
  82. }
  83. function PlanetDestroy()
  84. {
  85.    var s = 1;
  86.    while(s < 10)
  87.    {
  88.       eval("_root.main_backgr.star_" + s)._y = 70 + Math.random() * 290;
  89.       s++;
  90.    }
  91.    _root.globalBang = 30;
  92.    _root.planet_destroyed = true;
  93.    _root.mountain._visible = false;
  94.    _root.radar_1._visible = false;
  95.    _root.radar_2._visible = false;
  96.    var i = 0;
  97.    while(i < 6)
  98.    {
  99.       _root.AttachBang(Math.random() * 400 + 75,Math.random() * 250 + 100);
  100.       i++;
  101.    }
  102. }
  103. function LevelInit()
  104. {
  105.    var _loc1_ = _root;
  106.    _loc1_.level += 1;
  107.    _loc1_.EnemyAr = new Array(false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false);
  108.    _loc1_.enemy_shots = 0;
  109.    _loc1_.bangs_count = 0;
  110.    _loc1_.mines_count = 0;
  111.    _loc1_.score_counter = 0;
  112.    _loc1_.ship_x = 0;
  113.    _loc1_.ship_speed = 0;
  114.    _loc1_.baiters_time = 800;
  115.    _loc1_.enemies_on = 0;
  116.    _loc1_.player_on = false;
  117.    _loc1_.hyperspace = false;
  118.    _loc1_.globalBang = 0;
  119.    _loc1_.EnemyAttach(0,false,275,210);
  120.    _loc1_.timer_enemy = 20;
  121.    _loc1_.enemies_to_kill = (_loc1_.level - 1) * 5 + 15;
  122.    _loc1_.paused = false;
  123. }
  124. function GameInit()
  125. {
  126.    var _loc1_ = _root;
  127.    _loc1_.track_play = false;
  128.    _loc1_.splash_music.stop();
  129.    _loc1_.pick_up_man = 0.9;
  130.    _loc1_.enemy_speed = 1;
  131.    _loc1_.en_shooting = 1;
  132.    _loc1_.planet_destroyed = false;
  133.    _loc1_.max_speed = 24;
  134.    _loc1_.x_dimension = 2357.6;
  135.    _loc1_.smartbombs = 3;
  136.    _loc1_.lives = 3;
  137.    _loc1_.score = 0;
  138.    _loc1_.level = 0;
  139.    _loc1_.AstroAr = new Array(true,true,true,true,true,true,true,true,true,true,true);
  140.    _loc1_.ex_lives_array = new Array(true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false);
  141.    _loc1_.ex_bomb_array = new Array(true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false);
  142.    _loc1_.max_astronauts = 11;
  143. }
  144. function Scoring(x, y, score_inc)
  145. {
  146.    var _loc1_ = _root;
  147.    _loc1_.score += score_inc;
  148.    _loc1_.bubble = attachMovie("score_bubble","sc_b_" + _loc1_.score_counter,_loc1_.score_counter + 70);
  149.    _loc1_.bubble._x = x;
  150.    _loc1_.bubble._y = y;
  151.    _loc1_.bubble.score = score_inc;
  152.    _loc1_.score_counter += 1;
  153.    if(_loc1_.score_counter == 10)
  154.    {
  155.       _loc1_.score_counter = 0;
  156.    }
  157.    _loc1_.ExtraLife();
  158.    _loc1_.ExtraBomb();
  159. }
  160. function RemoveAmmo()
  161. {
  162.    _root.colTrans = {ra:100,rb:0,ga:100,gb:0,ba:100,bb:0,aa:100,ab:0};
  163.    _root.bigBangColor.setTransform(_root.colTrans);
  164.    var a = 1;
  165.    while(a < 20)
  166.    {
  167.       removeMovieClip(eval("_root.ensh_" + a));
  168.       removeMovieClip(eval("_root.mine_" + a));
  169.       a++;
  170.    }
  171.    var a = 1;
  172.    while(a < 16)
  173.    {
  174.       var man = eval("_root.man_" + a);
  175.       man._y = 370;
  176.       man.action = 0;
  177.       var ship = eval("_root.ship_" + a);
  178.       if(ship.action > 0)
  179.       {
  180.          ship.action = 0;
  181.       }
  182.       var dx = Math.random() >= 0.5 ? Math.random() * 300 + 1000 : (- Math.random()) * 300 - 500;
  183.       var x = _root.ToNewX(0,dx);
  184.       ship.x = x;
  185.       ship._y = Math.random() * 100 + 100;
  186.       ship._x = 1000;
  187.       a++;
  188.    }
  189. }
  190. function PlBang()
  191. {
  192. }
  193. function PlayerHitted()
  194. {
  195.    var _loc1_ = _root;
  196.    if(_loc1_.player_on && !_loc1_.hyperspace)
  197.    {
  198.       _loc1_.player_on = false;
  199.       _loc1_.ship_speed = 0;
  200.       _loc1_.message.gotoAndStop(1);
  201.       _loc1_.attachMovie("player_bang","player_bang",5);
  202.       _loc1_.player_bang._x = _loc1_.ship_0._x;
  203.       _loc1_.player_bang._y = _loc1_.ship_0._y;
  204.       _loc1_.ship_0._y = 210;
  205.       _loc1_.ship_0._x = 275;
  206.       _loc1_.ship_0.dy = 0;
  207.       if(_loc1_.sound_on)
  208.       {
  209.          _loc1_.smart_sfx.start(0,1);
  210.       }
  211.       _loc1_.lives -= 1;
  212.       if(_loc1_.lives == 0)
  213.       {
  214.          delete _loc1_.onEnterFrame;
  215.          _loc1_.ship_0.turbine.stop();
  216.          _loc1_.gotoAndPlay("game_over");
  217.       }
  218.    }
  219. }
  220. function AttachBang(x, y)
  221. {
  222.    if(_root.sound_on)
  223.    {
  224.       _root.blast_sfx.start(0,1);
  225.    }
  226.    _root.attachMovie("bang","b_" + _root.bangs_count,_root.bangs_count + 100);
  227.    eval("_root.b_" + _root.bangs_count)._x = x;
  228.    eval("_root.b_" + _root.bangs_count)._y = y;
  229.    _root.bangs_count += 1;
  230.    if(_root.bangs_count > 19)
  231.    {
  232.       _root.bangs_count = 0;
  233.    }
  234. }
  235. function AttachOnLevel(level)
  236. {
  237.    var _loc1_ = _root;
  238.    var _loc2_ = Math.random();
  239.    switch(level)
  240.    {
  241.       case 0:
  242.          _loc1_.EnemyAttach(3,true);
  243.          break;
  244.       case 1:
  245.          if(!_loc1_.planet_destroyed)
  246.          {
  247.             _loc1_.EnemyAttach(1,true);
  248.          }
  249.          else
  250.          {
  251.             _loc1_.EnemyAttach(2,true);
  252.          }
  253.          break;
  254.       case 2:
  255.          if(_loc2_ < 0.7)
  256.          {
  257.             if(!_loc1_.planet_destroyed)
  258.             {
  259.                _loc1_.EnemyAttach(1,true);
  260.             }
  261.             else
  262.             {
  263.                _loc1_.EnemyAttach(2,true);
  264.             }
  265.          }
  266.          else
  267.          {
  268.             _loc1_.EnemyAttach(4,true);
  269.          }
  270.          break;
  271.       case 3:
  272.       case 4:
  273.          if(_loc2_ < 0.7)
  274.          {
  275.             if(!_loc1_.planet_destroyed)
  276.             {
  277.                _loc1_.EnemyAttach(1,true);
  278.             }
  279.             else
  280.             {
  281.                _loc1_.EnemyAttach(2,true);
  282.             }
  283.          }
  284.          else if(_loc2_ < 0.85)
  285.          {
  286.             _loc1_.EnemyAttach(4,true);
  287.          }
  288.          else
  289.          {
  290.             _loc1_.EnemyAttach(5,true);
  291.          }
  292.          break;
  293.       default:
  294.          if(_loc2_ < 0.6)
  295.          {
  296.             if(!_loc1_.planet_destroyed)
  297.             {
  298.                _loc1_.EnemyAttach(1,true);
  299.             }
  300.             else
  301.             {
  302.                _loc1_.EnemyAttach(2,true);
  303.             }
  304.          }
  305.          else if(_loc2_ < 0.75)
  306.          {
  307.             _loc1_.EnemyAttach(4,true);
  308.          }
  309.          else if(_loc2_ < 0.9)
  310.          {
  311.             _loc1_.EnemyAttach(5,true);
  312.          }
  313.          else
  314.          {
  315.             _loc1_.EnemyAttach(3,true);
  316.          }
  317.    }
  318. }
  319. function Mine()
  320. {
  321. }
  322. function EnemyAttach(type_enemy, randomly, x, y)
  323. {
  324.    if(type_enemy == 0)
  325.    {
  326.       _root.locator.ship_0._visible = false;
  327.       _root.attachMovie("compile","comp_" + j,50 + j);
  328.       eval("_root.comp_" + j).type_enemy = type_enemy;
  329.       eval("_root.comp_" + j).ship_index = j;
  330.       eval("_root.comp_" + j).x = x;
  331.       eval("_root.comp_" + j).y = y;
  332.    }
  333.    if(type_enemy > 0 && (_root.enemies_to_kill > 0 || type_enemy == 2 && !_root.planet_destroyed))
  334.    {
  335.       var j = 1;
  336.       while(j < _root.max_enemies + 1)
  337.       {
  338.          if(!_root.EnemyAr[j])
  339.          {
  340.             _root.EnemyAr[j] = true;
  341.             _root.attachMovie("compile","comp_" + j,50 + j);
  342.             eval("_root.comp_" + j).type_enemy = type_enemy;
  343.             eval("_root.comp_" + j).ship_index = j;
  344.             if(randomly)
  345.             {
  346.                eval("_root.comp_" + j).x = -10;
  347.             }
  348.             else
  349.             {
  350.                eval("_root.comp_" + j).x = x;
  351.                eval("_root.comp_" + j).y = y;
  352.             }
  353.             j = 20;
  354.          }
  355.          j++;
  356.       }
  357.    }
  358. }
  359. function Compile()
  360. {
  361. }
  362. function CompilePart()
  363. {
  364. }
  365. function EnShooting(x, y, screen_x)
  366. {
  367.    if(screen_x > -10 && screen_x < 560)
  368.    {
  369.       if(_root.sound_on)
  370.       {
  371.          _root.en_shot_sfx.start(0,1);
  372.       }
  373.       _root.attachMovie("enemy_shot","ensh_" + _root.enemy_shots,_root.enemy_shots + 5000);
  374.       this.shoot = eval("_root.ensh_" + _root.enemy_shots);
  375.       this.shoot.x = x;
  376.       this.shoot._y = y;
  377.       this.ang = Math.atan2(_root.ship_0._y - y,_root.ship_0._x - screen_x);
  378.       this.shoot.dx = 5 * Math.cos(this.ang);
  379.       this.shoot.dy = 5 * Math.sin(this.ang);
  380.       _root.enemy_shots += 1;
  381.       if(_root.enemy_shots == 20)
  382.       {
  383.          _root.enemy_shots = 0;
  384.       }
  385.    }
  386. }
  387. function EnShot()
  388. {
  389. }
  390. function Bang()
  391. {
  392. }
  393. function BangPart()
  394. {
  395. }
  396. function PlShot()
  397. {
  398. }
  399. function SingleStar()
  400. {
  401. }
  402. PlBang.prototype = new MovieClip();
  403. PlBang.prototype.onLoad = function()
  404. {
  405.    _root.locator.ship_0._visible = false;
  406.    _root.globalBang = 110;
  407.    var j = 1;
  408.    while(j < 10)
  409.    {
  410.       this.attachMovie("bang_part","bp_" + j,j);
  411.       if(eval("_root.comp_" + j) != undefined)
  412.       {
  413.          _root.EnemyAr[j] = false;
  414.          removeMovieClip(eval("_root.comp_" + j));
  415.       }
  416.       j++;
  417.    }
  418. };
  419. PlBang.prototype.onEnterFrame = function()
  420. {
  421.    this._alpha -= 4;
  422. };
  423. Object.registerClass("player_bang",PlBang);
  424. Mine.prototype = new MovieClip();
  425. Mine.prototype.onEnterFrame = function()
  426. {
  427.    var _loc1_ = this;
  428.    var _loc2_ = _root;
  429.    if(!_loc2_.paused)
  430.    {
  431.       if(_loc1_.hitTest(_loc2_.ship_0))
  432.       {
  433.          _loc2_.PlayerHitted();
  434.       }
  435.       _loc1_.x = _loc2_.ToNewX(_loc1_.x,0);
  436.       _loc1_._x = _loc2_.ToGlobal(_loc1_.x);
  437.    }
  438. };
  439. Object.registerClass("mine",Mine);
  440. Compile.prototype = new MovieClip();
  441. Compile.prototype.onLoad = function()
  442. {
  443.    var _loc1_ = this;
  444.    var _loc2_ = _root;
  445.    if(_loc1_.x < 0)
  446.    {
  447.       _loc1_.x = Math.random() * _loc2_.x_dimension;
  448.       _loc1_._y = Math.random() * 100 + 100;
  449.    }
  450.    else
  451.    {
  452.       _loc1_._y = _loc1_.y;
  453.    }
  454.    _loc1_._alpha = 0;
  455.    j = 1;
  456.    while(j < 4)
  457.    {
  458.       _loc1_.attachMovie("compile_part","cp_" + j,j);
  459.       j++;
  460.    }
  461.    if(_loc2_.ToGlobal(_loc1_.x) < 560 && _loc2_.sound_on)
  462.    {
  463.       _loc2_.ship_appear.start(0,1);
  464.    }
  465. };
  466. Compile.prototype.onEnterFrame = function()
  467. {
  468.    var _loc1_ = this;
  469.    _loc1_.x = _root.ToNewX(_loc1_.x,0);
  470.    _loc1_._x = _root.ToGlobal(_loc1_.x);
  471.    _loc1_._alpha += 5;
  472. };
  473. Object.registerClass("compile",Compile);
  474. CompilePart.prototype = new MovieClip();
  475. CompilePart.prototype.onLoad = function()
  476. {
  477.    var _loc1_ = this;
  478.    _loc1_.rad = Math.random() * 30 + 90;
  479.    _loc1_.ang = Math.random() * 6.28;
  480.    _loc1_._x = Math.cos(_loc1_.ang) * _loc1_.rad;
  481.    _loc1_._y = Math.sin(_loc1_.ang) * _loc1_.rad;
  482.    _loc1_.dv = Math.random() * 8 + 16;
  483. };
  484. CompilePart.prototype.onEnterFrame = function()
  485. {
  486.    var _loc1_ = this;
  487.    if(!_root.paused)
  488.    {
  489.       _loc1_.dx = _loc1_._x;
  490.       _loc1_.dy = _loc1_._y;
  491.       _loc1_._x -= _loc1_.dx / _loc1_.dv;
  492.       _loc1_._y -= _loc1_.dy / _loc1_.dv;
  493.    }
  494. };
  495. Object.registerClass("compile_part",CompilePart);
  496. EnShot.prototype = new MovieClip();
  497. EnShot.prototype.onEnterFrame = function()
  498. {
  499.    var _loc1_ = this;
  500.    var _loc2_ = _root;
  501.    if(!_loc2_.paused)
  502.    {
  503.       if(_loc2_.ship_0.hot_spot.hitTest(_loc1_._x,_loc1_._y,true))
  504.       {
  505.          _loc2_.PlayerHitted();
  506.       }
  507.       _loc1_.x = _loc2_.ToNewX(_loc1_.x,_loc1_.dx * _loc2_.en_shot_speed);
  508.       _loc1_._x = _loc2_.ToGlobal(_loc1_.x);
  509.       _loc1_._y += _loc1_.dy * _loc2_.en_shot_speed;
  510.       if(_loc1_._x > 600 || _loc1_._x < -50 || _loc1_._y > 410 || _loc1_._y < 60)
  511.       {
  512.          removeMovieClip(_loc1_);
  513.       }
  514.    }
  515. };
  516. Object.registerClass("enemy_shot",EnShot);
  517. Bang.prototype = new MovieClip();
  518. Bang.prototype.onLoad = function()
  519. {
  520.    var _loc2_ = this;
  521.    var _loc1_ = 1;
  522.    while(_loc1_ < 5)
  523.    {
  524.       _loc2_.attachMovie("bang_part","bp_" + _loc1_,_loc1_);
  525.       _loc1_ = _loc1_ + 1;
  526.    }
  527. };
  528. Bang.prototype.onEnterFrame = function()
  529. {
  530.    this._x -= _root.ship_speed;
  531.    this._alpha -= 4;
  532. };
  533. Object.registerClass("bang",Bang);
  534. BangPart.prototype = new MovieClip();
  535. BangPart.prototype.onLoad = function()
  536. {
  537.    var _loc1_ = this;
  538.    _loc1_.rad = Math.random() * 8 + 8;
  539.    _loc1_.ang = Math.random() * 6.28;
  540.    _loc1_.dx = Math.cos(_loc1_.ang) * _loc1_.rad;
  541.    _loc1_.dy = Math.sin(_loc1_.ang) * _loc1_.rad;
  542. };
  543. BangPart.prototype.onEnterFrame = function()
  544. {
  545.    var _loc1_ = this;
  546.    if(!_root.paused)
  547.    {
  548.       _loc1_._x += _loc1_.dx;
  549.       _loc1_._y += _loc1_.dy;
  550.       _loc1_.dx *= 0.9;
  551.       _loc1_.dy = (_loc1_.dy + 0.3) * 0.9;
  552.    }
  553. };
  554. Object.registerClass("bang_part",BangPart);
  555. PlShot.prototype = new MovieClip();
  556. PlShot.prototype.onLoad = function()
  557. {
  558.    var _loc1_ = this;
  559.    var _loc2_ = _root;
  560.    _loc1_.clr = new Color(_loc1_);
  561.    _loc1_.clr_trans = new Object();
  562.    _loc1_.clr_trig = Math.floor(Math.random() * 4);
  563.    switch(_loc1_.clr_trig)
  564.    {
  565.       case 0:
  566.          _loc1_.clr.setRGB(65535);
  567.          break;
  568.       case 1:
  569.          _loc1_.clr.setRGB(65280);
  570.          break;
  571.       case 2:
  572.          _loc1_.clr.setRGB(16776960);
  573.          break;
  574.       case 3:
  575.          _loc1_.clr.setRGB(16755455);
  576.    }
  577.    if(_loc2_.ship_0._xscale < 0)
  578.    {
  579.       _loc1_.dx = -30;
  580.    }
  581.    else
  582.    {
  583.       _loc1_.dx = 30;
  584.    }
  585.    _loc1_._x = _loc2_.ship_0._x - _loc1_.dx;
  586.    _loc1_._y = _loc2_.ship_0._y;
  587.    _loc1_._xscale = 0;
  588. };
  589. PlShot.prototype.onEnterFrame = function()
  590. {
  591.    if(!_root.paused)
  592.    {
  593.       var i = 1;
  594.       while(i < 16)
  595.       {
  596.          this.ship = eval("_root.ship_" + i);
  597.          if(this.hitTest(this.ship))
  598.          {
  599.             this.ship.Destroy(false);
  600.             _root.EnemyAr[i] = false;
  601.             removeMovieClip(this);
  602.          }
  603.          this.man = eval("_root.man_" + i);
  604.          if(this.hitTest(this.man))
  605.          {
  606.             this.man.Destroy();
  607.             removeMovieClip(this);
  608.          }
  609.          i++;
  610.       }
  611.       this._x += this.dx;
  612.       if(this._x > 600 || this._x < -50)
  613.       {
  614.          removeMovieClip(this);
  615.       }
  616.       if(this._width <= 100)
  617.       {
  618.          this._xscale += this.dx;
  619.       }
  620.    }
  621. };
  622. Object.registerClass("player_shot",PlShot);
  623. ToNewX = function(x, dx)
  624. {
  625.    var _loc2_ = _root;
  626.    var _loc1_ = x + dx;
  627.    if(_loc1_ < 0)
  628.    {
  629.       _loc1_ = _loc2_.x_dimension + _loc1_;
  630.    }
  631.    if(_loc1_ > _loc2_.x_dimension)
  632.    {
  633.       _loc1_ -= _loc2_.x_dimension;
  634.    }
  635.    return _loc1_;
  636. };
  637. ToGlobal = function(local_x)
  638. {
  639.    var _loc1_ = - _root.ship_x + local_x;
  640.    if(_loc1_ < 0)
  641.    {
  642.       var _loc2_ = _root.x_dimension + _loc1_;
  643.    }
  644.    else
  645.    {
  646.       _loc2_ = _loc1_;
  647.    }
  648.    return _loc2_;
  649. };
  650. ToRadarCoords = function(local_x)
  651. {
  652.    var _loc3_ = _root;
  653.    var _loc1_ = (- _loc3_.ship_x + local_x) / 10 + 245;
  654.    if(_loc1_ < 157)
  655.    {
  656.       var _loc2_ = _loc3_.x_dimension / 10 + _loc1_;
  657.    }
  658.    else if(_loc1_ > 393)
  659.    {
  660.       _loc2_ = (- _loc3_.x_dimension) / 10 + _loc1_;
  661.    }
  662.    else
  663.    {
  664.       _loc2_ = _loc1_;
  665.    }
  666.    return _loc2_;
  667. };
  668. SingleStar.prototype = new MovieClip();
  669. SingleStar.prototype.onLoad = function()
  670. {
  671.    var _loc1_ = this;
  672.    _loc1_.gotoAndStop(Math.floor(Math.random() * 5 + 1));
  673.    _loc1_.ax = Math.random() + 1.2;
  674.    _loc1_._y = Math.random() * 170 + 70;
  675.    _loc1_._x = Math.random() * 500 + 25;
  676. };
  677. SingleStar.prototype.onEnterFrame = function()
  678. {
  679.    var _loc1_ = this;
  680.    if(!_root.paused)
  681.    {
  682.       _loc1_._x -= _loc1_.ax * _root.ship_speed / 16;
  683.       if(_loc1_._x > 560)
  684.       {
  685.          _loc1_._x = -5;
  686.       }
  687.       if(_loc1_._x < -10)
  688.       {
  689.          _loc1_._x = 555;
  690.       }
  691.    }
  692. };
  693. Object.registerClass("star",SingleStar);
  694.